import React, { Fragment } from 'react'
import 'antd/dist/antd.css'




import { Route, Switch , Redirect} from 'react-router-dom'

import Register from './view/register'
import Login from './view/login'
import Profile from './view/profile'
import Pamphlet from './view/pamphlet'
import Footer from './common/Footer'
import Home from './view/home'

import Friend from './view/profile/service/friend'
import ADDFriend from './view/profile/service/friend/add_friend'
import FriendChat from './view/profile/service/friend/chat'

const main = ()=>{
  return(
    <Fragment>
   
            <Footer></Footer>

            <Switch>
              {/* switch嵌套后，匹配到一个就不匹配了 */}
              <Route path = '/main/home' component = {Home}></Route>
              <Route path = '/main/login'  component={Login}></Route>
              <Route path = '/main/register'  component={Register}></Route>
              <Route path = '/main/profile' exact component={Profile}></Route>
              <Route path = '/main/profile/friend' exact  component={Friend}></Route>
              <Route path = '/main/profile/friend/add' exact component={ADDFriend}></Route>
              <Route path = '/main/profile/fchat' exact component= {FriendChat}></Route>
              <Route path = '/main/pamphlet' component={Pamphlet}></Route>
             
              {/* 谁都没匹配到时，走redirect */}
              <Redirect to='/main/login'/>
            </Switch>

    </Fragment>  
  )
}

export default main;